<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no" />
		<title>完善资料</title>

		<link rel="stylesheet" href="/base-online/Public/assets/css/css.css" />
		<script src="/base-online/Public/assets/js/jquery-2.0.3.min.js" type="text/javascript"></script>
		<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
		<!--时间下拉列表-->
		<script type="text/javascript"> 
			function DateSelector(selYear, selMonth, selDay) { 
			this.selYear = selYear; 
			this.selMonth = selMonth; 
			this.selDay = selDay; 
			this.selYear.Group = this; 
			this.selMonth.Group = this; 
			// 给年份、月份下拉菜单添加处理onchange事件的函数 
			if (window.document.all != null) // IE 
			{ 
			this.selYear.attachEvent("onchange", DateSelector.Onchange); 
			this.selMonth.attachEvent("onchange", DateSelector.Onchange); 
			} 
			else // Firefox 
			{ 
			this.selYear.addEventListener("change", DateSelector.Onchange, false); 
			this.selMonth.addEventListener("change", DateSelector.Onchange, false); 
			} 
			if (arguments.length == 4) // 如果传入参数个数为4，最后一个参数必须为Date对象 
			this.InitSelector(arguments[3].getFullYear(), arguments[3].getMonth() + 1, arguments[3].getDate()); 
			else if (arguments.length == 6) // 如果传入参数个数为6，最后三个参数必须为初始的年月日数值 
			this.InitSelector(arguments[3], arguments[4], arguments[5]); 
			else // 默认使用当前日期 
			{ 
			var dt = new Date(); 
			this.InitSelector(dt.getFullYear(), dt.getMonth() + 1, dt.getDate()); 
			} 
			} 
			// 增加一个最大年份的属性 
			DateSelector.prototype.MinYear = 1900; 
			// 增加一个最大年份的属性 
			DateSelector.prototype.MaxYear = (new Date()).getFullYear(); 
			// 初始化年份 
			DateSelector.prototype.InitYearSelect = function () { 
			// 循环添加OPION元素到年份select对象中 
			for (var i = this.MaxYear; i >= this.MinYear; i--) { 
			// 新建一个OPTION对象 
			var op = window.document.createElement("OPTION"); 
			// 设置OPTION对象的值 
			op.value = i; 
			// 设置OPTION对象的内容 
			op.innerHTML = i; 
			// 添加到年份select对象 
			this.selYear.appendChild(op); 
			} 
			} 
			// 初始化月份 
			DateSelector.prototype.InitMonthSelect = function () { 
			// 循环添加OPION元素到月份select对象中 
			for (var i = 1; i < 13; i++) { 
			// 新建一个OPTION对象 
			var op = window.document.createElement("OPTION"); 
			// 设置OPTION对象的值 
			op.value = i; 
			// 设置OPTION对象的内容 
			op.innerHTML = i; 
			// 添加到月份select对象 
			this.selMonth.appendChild(op); 
			} 
			} 
			// 根据年份与月份获取当月的天数 
			DateSelector.DaysInMonth = function (year, month) { 
			var date = new Date(year, month, 0); 
			return date.getDate(); 
			} 
			// 初始化天数 
			DateSelector.prototype.InitDaySelect = function () { 
			// 使用parseInt函数获取当前的年份和月份 
			var year = parseInt(this.selYear.value); 
			var month = parseInt(this.selMonth.value); 
			// 获取当月的天数 
			var daysInMonth = DateSelector.DaysInMonth(year, month); 
			// 清空原有的选项 
			this.selDay.options.length = 0; 
			// 循环添加OPION元素到天数select对象中 
			for (var i = 1; i <= daysInMonth; i++) { 
			// 新建一个OPTION对象 
			var op = window.document.createElement("OPTION"); 
			// 设置OPTION对象的值 
			op.value = i; 
			// 设置OPTION对象的内容 
			op.innerHTML = i; 
			// 添加到天数select对象 
			this.selDay.appendChild(op); 
			} 
			} 
			// 处理年份和月份onchange事件的方法，它获取事件来源对象（即selYear或selMonth） 
			// 并调用它的Group对象（即DateSelector实例，请见构造函数）提供的InitDaySelect方法重新初始化天数 
			// 参数e为event对象 
			DateSelector.Onchange = function (e) { 
			var selector = window.document.all != null ? e.srcElement : e.target; 
			selector.Group.InitDaySelect(); 
			} 
			// 根据参数初始化下拉菜单选项 
			DateSelector.prototype.InitSelector = function (year, month, day) { 
			// 由于外部是可以调用这个方法，因此我们在这里也要将selYear和selMonth的选项清空掉 
			// 另外因为InitDaySelect方法已经有清空天数下拉菜单，因此这里就不用重复工作了 
			this.selYear.options.length = 0; 
			this.selMonth.options.length = 0; 
			// 初始化年、月 
			this.InitYearSelect(); 
			this.InitMonthSelect(); 
			// 设置年、月初始值 
			this.selYear.selectedIndex = this.MaxYear - year; 
			this.selMonth.selectedIndex = month - 1; 
			// 初始化天数 
			this.InitDaySelect(); 
			// 设置天数初始值 
			this.selDay.selectedIndex = day - 1; 
			} 
			</script> 
		<style type="text/css">
 body
 {
  font-size:12px;
  font-family:'宋体';
 }
 #sex_male ,
 #sex_female ,
 #sex_nomale
 {
  display:none
 }
 label
 {
  display:-moz-inline-block;
  display:inline-block;
  cursor:pointer;
  margin:5px 0;
  padding-left:20px;
  line-height:15px;
  background:url("/base-online/Public/1.gif") no-repeat left top;
 }
 label.checked
 {
  background-position:left bottom;
 }
</style>
<script type="text/javascript">
 window.onload = function() 
 {
  labels = document.getElementById('male').getElementsByTagName('label');
  radios = document.getElementById('male').getElementsByTagName('input');
  for(i=0,j=labels.length ; i<j ; i++)
  {
   labels[i].onclick=function() 
   {
    if(this.className == '') {
     for(k=0,l=labels.length ; k<l ; k++)
     {
      labels[k].className='';
	  radios[k].checked = false;
     }
     this.className='checked';
	 try{
	 	document.getElementById(this.name).checked = true;
	 } catch (e) {}
    }
   }
  }
 }
 var male_obj = {'male':'男', 'female':'女'};
 function checkform(obj) {
 	for (i = 0; i < obj.sex.length; i++) {
		if (obj.sex[i].checked) {
			alert(male_obj[obj.sex[i].value]);
			break;
		}
	}
	return false;
 }
</script>


<script type="text/javascript">
wx.config({
    debug: false,
    appId: "<?php echo ($arr["appId"]); ?>",
    timestamp:"<?php echo ($arr["timestamp"]); ?>",
    nonceStr:"<?php echo ($arr["nonceStr"]); ?>",
    signature:"<?php echo ($arr["signature"]); ?>",
    jsApiList: [
        'checkJsApi',
        'openLocation',
        'getLocation',
        'scanQRCode',
      ]
});
	
	wx.checkJsApi({
    jsApiList: [
        'getLocation'
    ],
    success: function (res) {
  
        if (res.checkResult.getLocation == false) {
            alert('你的微信版本太低，不支持微信JS接口，请升级到最新的微信版本！');
            return;
        }
    }
});

	wx.getLocation({
    success: function (res) {
        var latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
        var longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。
        var speed = res.speed; // 速度，以米/每秒计
        var accuracy = res.accuracy; // 位置精度
    },
    cancel: function (res) {
        alert('用户拒绝授权获取地理位置');
    }
});


	wx.ready(function () {
		$("#button").click(function(){ //alert('111');
		wx.scanQRCode({
    	needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
   		 scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
    	success: function (res) {
   		var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
   		
   		if(result!=''){
   		 	//alert(result);
   		 	$("#scan").val(result);
   		 	$("#scan1").val(result);
   		}else{
   			alert("扫码失败");
   		}
	}
	});
});
		
});
</script>
<script type="text/javascript">
	var heigt=document.documentElement.clientHeight;
	var widte=document.documentElement.clientWidth;
	var name="<?php echo ($list["name"]); ?>";
		$(document).ready(function(e) {
 		
 			$('body').css({"height":heigt,"width":widte});
		});		
</script>
<style>
	.body{background:#e9e9e9; color: #333333;}
	.body form{ width: 90%; margin: 0px auto;}
	.body form input{  height: 40px; line-height: 30px; font-size: 14px; width:90%; padding-left: 10%; border-radius: 5px; border: none;  }
	.body form button{ width:100%; height: 36px; margin-top: 20px; border: none; background: #aadbe7; color:#ffffff;border-radius:5px; font-size: 18px;}
	.sex{height: 40px; line-height: 40px; font-size: 14px; width:90%; padding-left: 10%; border-radius: 5px; border: none;}
	.h3{color: #999;float: left;height:40px; }
	.biao{float: left; width: 40px; height:40px; border-radius:50%; background: #fff;}
	.kuan{ float: left; width: 20px;height:40px;}
	.yuan{ width: 20px; height: 20px; margin: 10px; background: red;border-radius:50%;}
</style>


	</head>

	<body  class="body" >
		<h2 style=" height: 20px; line-height: 80px; padding-left: 20px; color: #333333; "></h2>
		 <form action="<?php echo U('Index/adduser');?>"  method="get">
			
		 	<button type="button" id="button" >扫一扫</button>
			
		 	<input type="hidden" value="<?php echo ($list["id"]); ?>" name="id" />
		 	
		 	<div style=" height: 5px;"></div>
			<input type="text"  placeholder="姓名（必填）" name="name" required  value="<?php echo ($list["name"]); ?>" />

			
			
			<div style=" height: 5px;"></div>
			<input type="text"  placeholder="手机号（必填）" name="tel" required="required"  value="<?php echo ($list["tel"]); ?>" pattern="((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)" title="请填写正确的手机号" />	 
			<div style=" height: 5px;"></div>
			<input type="text"  placeholder="扫码结果" name="scan" disabled="true"  id="scan" value="<?php echo ($list["scan"]); ?>" />
			<input type="hidden"  placeholder="扫码结果" name="scan"  id="scan1" value="<?php echo ($list["scan"]); ?>" />
			<!-- <div style=" height: 5px;"></div>
			<div  class="sex">
				<div class="h3">性别：</div>
				<div class="nan biao"><div  class="yuan"><span>男:</span></div></div>
				<div class="kuan"></div>
				<div class="nv biao"><div class="yuan">女:</div></div>
				
			</div>	 -->
			<table border="0">
			  <tr>
			    <td width="200" id="male">
					性别：<input type="radio" id="sex_male" <?php if($list["sex"] == '1'): ?>checked="checked"<?php endif; ?> name="sex" value="1" /><label name="sex_male" <?php if($list["sex"] == '1'): ?>class="checked"<?php endif; ?>  for="sex_male">男</label>
			  		<input type="radio" id="sex_female" <?php if($list["sex"] == '2'): ?>checked="checked"<?php endif; ?> name="sex" value="2" /><label name="sex_female" <?php if($list["sex"] == '2'): ?>class="checked"<?php endif; ?> for="sex_female">女</label>
				</td>
			  </tr>
			 <tr>
			 	<td>年:<select id="selYear"></select> </td>
			 	<td>月:<select id="selMonth"></select> </td>
			 	<td>日:<select id="selDay"></select> </td>
			 	
			 </tr>
			 </table>
		

			 
			
			
		 	<button type="submit" ><?php if($list["scan"] == ''): ?>绑定<?php endif; if($list["scan"] != ''): ?>修改<?php endif; ?></button>
		 </form>

	</body>
		<script type="text/javascript"> 
		var selYear = window.document.getElementById("selYear"); 
		var selMonth = window.document.getElementById("selMonth"); 
		var selDay = window.document.getElementById("selDay"); 
		new DateSelector(selYear, selMonth, selDay, 2004, 2, 29); 
		</script> 
</html>